﻿using System.Configuration;

namespace OWE.Service.Configuration
{
   public class ConfigManager
    {
       public static TConfig GetConfigValue<TConfig>(string key, object defaultValue = null)
       {
           var configValue = ConfigurationManager.AppSettings[key];

           if (!string.IsNullOrEmpty(configValue))
           {
               return ConvertHelper.ConvertValue<TConfig>(configValue);
           }
           else
           {
               return ConvertHelper.ConvertValue<TConfig>(defaultValue);
           }
       }
    }
}
